<template class="body">
  <div>
    <div class="topv" style="height: 80px">
      <div class="top">
        <div>
        <a href="/"><img src="../static/logo.png"></a>
        </div>
        <div class="topv">
          <el-input v-model="search" placeholder="search..." size="small"></el-input>
          <el-button class="ml" type="info" size="mini" @click="baseSearch()">查询</el-button>
        </div>
      </div>
    </div>
    <div class="menuv">
      <div class="menu">
        <div class="flx" :class="activeIndex == '1' ? 'defBack' : ''" @click="changeAct('1')">Home</div>
        <div class="flx" :class="activeIndex == '2' ? 'defBack' : ''" @click="changeAct('2','2')">News</div>
        <div class="flx" :class="activeIndex == '3' ? 'defBack' : ''" @click="changeAct('3','3')">Samples</div>
        <!--<div class="flx" :class="activeIndex == '4' ? 'defBack' : ''" @click="changeAct('4','4')">Universities</div>-->
        <div class="flx" :class="activeIndex == '5' ? 'defBack' : ''" @click="changeAct('5')">Process</div>
        <div class="flx" :class="activeIndex == '6' ? 'defBack' : ''" @click="changeAct('6')">Payment</div>
        <div class="flx" :class="activeIndex == '7' ? 'defBack' : ''" @click="changeAct('7')">Contact</div>
      </div>
    </div>
    <div class="lunbo">
      <el-carousel :interval="3500" height="330px" arrow="always">
        <el-carousel-item>
          <img src="../static/home1.png"/>
        </el-carousel-item>
        <el-carousel-item>
          <img src="../static/home2.jpg"/>
        </el-carousel-item>
        <!--<el-carousel-item>
          <img src="../static/1-151005120402238.jpg"/>
        </el-carousel-item>-->
      </el-carousel>
    </div>
    <!-- 内容 -->
    <div class="home">
      <div class="content">
        <!-- 左侧 -->
        <div class="listl">
          <div class="mod cateul">
            <div class="modtit">
              <h3>Samples</h3>
            </div>
            <div class="modcon">
              <table width="256" cellspacing="10" border="0">
                <tbody v-for="(item,index) in content.samp" :key="index">

                <tr>
                  <td width="30%"><a @click="changeSamples('3',item.subType)">
                    <img :src="item.pic"
                         alt="Australia diplomas"
                         title="Australia diplomas" width="50"
                         height="30" border="0" style="vertical-align: middle;"></a>
                  </td>
                  <td width="70%" class="tdtext">
                    <el-link type="primary" @click="changeSamples('3',item.subType)"
                             style="text-decoration:none;color: #666;font-size: 12px;">
                      {{item.content}}
                    </el-link>
                  </td>
                </tr>
                </tbody>
              </table>
              <!--
                            <div class="lfc" @click="switchContext()">{{ item.name}}</div>
                            <div class="rgc">{{ item.content }}</div>-->
            </div>
          </div>


          <div class="mod cateul">
            <div class="modtit">
              <h3>How to make a order</h3>
              <!--<span class="tit">Samples</span>-->
            </div>


            <div class="modcon">
              <ul class="modcate">
                <li>1: Fill in a form as follow:</li>
                <li>2: Pay 50% down payment as deposit.</li>
                <li>3: Confirm with you after finish drafts.</li>
                <li>4: After confirming, pay the balance.</li>
                <li>5：Printing, packaging the delivery.</li>
                <li>6: Send you the tracking numbers.</li>
              </ul>
            </div>
          </div>

          <div class="mod cateul">
            <div class="modtit">
              <h3>Information Forms Download</h3>
              <!--<span class="tit">Samples</span>-->
            </div>
            <div class="modcon" style="padding: 15px 1px">
              <ul class="modcate">
                <li><a style="list-style: none;text-decoration: none;" href="https://www.getfastdiploma.com/923img/Certificate&Degree&Diploma-17Form.xls" target="_blank">Certificate&Degree&Diploma-20 Form</a></li>
                <li><a style="list-style: none;text-decoration: none;"  href="https://www.getfastdiploma.com/Transcript-Form.xlsx" target="_blank">Transcript-20 Form</a></li>
              </ul>
            </div>
          </div>


          <div class="mod callus">
            <div class="modtit">
              <h3>
                <!--<a href="/Contact/">Contact us：</a>-->
                <el-link type="primary" @click="changeAct('7')" style="text-decoration:none;color: #666;
                font-family: 'microsoft yahei'; font-size:14px;font-weight: normal;">Contact us：
                </el-link>
              </h3>
            </div>
            <div class="modcon">
              <p style="line-height:20px;margin: 0;padding: 0;color: #666;font-size: 12px;font-family: Arial, tahoma;">
                WhatsApp：+86 1592********<br>
                WeChat/QQ：********* <br>
                Telegram：@orderdiploma878<br>
                Email：tobyotmz@outlook.com
              </p>
            </div>
          </div>


        </div>
        <!-- 右侧 -->
        <div class="rgv">
          <div>
            <!-- <div class="modtit">
               <span class="tit">about us</span>
             </div>-->
            <div class="cont">
              <!-- <div style="word-break: break-all" v-html="content.rgtit"></div> -->
              <div v-if="homeShow" class="cttit">
                <div class="view-box" v-html="noteContext"></div>
              </div>
              <div v-if="!homeShow" class="cttit">
                <div v-for="(item,index) in tableData" :key="index">
                  <!--<div class="lfc" @click="rowClick(item)">{{ item.title}}</div>
                  <div class="rgc">{{ item.createdTime }}</div>-->


                  <!-- <div style="height: 20px;padding: 5px">
                  <el-link type="primary" @click="rowClick(item)">{{ item.title}}</el-link>
                    <span>{{ item.createdTime }}</span>
                  </div>-->

                  <ul>
                    <li style="border-bottom: 1px dashed #666">
                      <el-link type="primary" @click="rowClick(item)" style="color: #666">{{ item.title}}</el-link>
                      <span style="color: #666;float:right">{{ item.createdTime }}</span>
                    </li>
                  </ul>


                </div>
                <el-pagination
                  background
                  layout="prev, pager, next"
                  :total="totalPage"
                  @current-change="pageQuery">
                </el-pagination>
              </div>
              <!-- <div v-else-if="type == 'news'" class="cttit">
                  {{ content.rgtit }}
              </div> -->
            </div>
          </div>
        </div>
      </div>
      <div v-if="isHome">
        <div class="modtit_bottem">
          <h3>Product display</h3>
        </div>
        <div class="anli">
          <ul class="anlicon">
            <li v-for="(item,index) in pics" :key="index">
              <div class="anlipic">
                <a><img :src="item.pic"> </a>
              </div>
              <p>
                <el-link type="primary" @click="rowClick(item)"
                         style="text-decoration:none;color: #666;font-size: 12px;">
                  {{item.title}}
                </el-link>
              </p>
            </li>

          </ul>
        </div>

      </div>


    </div>

  </div>
</template>
<script>
  // import homeContent from './components/homeContent.vue'
  import BottomContent from './components/bottomContent.vue';


  export default {
    components: {
      // homeContent
      BottomContent
    },
    data() {
      return {
        activeIndex: '1',
        totalPage: 0,
        search: '',

        tableData: [],
        homeShow: true,
        isHome: true,
        noteContext: '',
        pics: [],
        content: {
          type: "home",
          samp: [
            {
              name: '澳大利亚',
              content: 'Australia diplomas',
              subType: '澳大利亚',
              pic: require('../static/001.jpg'),
            },
            {
              name: '美国',
              content: 'USA diplomas',
              subType: '美国',
              pic: require('../static/mg.png'),
            },
            {
              name: '英国',
              content: 'England diplomas',
              subType: '英国',
              pic: require('../static/002.jpg'),
            },
            {
              name: '新西兰',
              content: 'New Zealand diplomas',
              subType: '新西兰',
              pic: require('../static/xinxilan.png'),
            },
            {
              name: '加拿大',
              content: 'Canada diplomas',
              subType: '加拿大',
              pic: require('../static/jnd.png'),
            },
            {
              name: 'Other countries',
              content: 'Other countries',
              subType: '其他',
              pic: require('../static/008.jpg'),
            }
          ],
          make: [
            {
              name: 'china',
              content: 'xxxxxxxxxx',
              subType: '5',
            },
            {
              name: 'china',
              content: 'xxxxxxxxxx',
              subType: '6',
            }
          ],
          rgtit: '123'
        },
        queryParam: {page: '1', limit: '20', type: '', subType: '', queryText: ''},
        queryPicParam: {page: '1', limit: '8'},

      };
    },
    beforeUpdate() {
    },
    mounted() {
      this.homeShow = true;
      this.showOne();
      this.getPicList();
    },
    methods: {
      pageQuery(val) {
        // this.queryParam.limit = '5';
        this.queryParam.page = val.toString();
        this.getDataList();
      },
      changeAct(val, type) {
        this.activeIndex = val;
        this.getDataList(type, '');
        if (val === '1') {
          this.isHome = true;
        } else {
          this.isHome = false;
        }
        if (val === '1' || val === '5' || val === '6' || val === '7') {
          this.homeShow = true;
          this.showOne(val);
          return;
        } else {
          this.homeShow = false;
        }
      },
      baseSearch() {
        this.homeShow = false;
        this.isHome = false;
        this.activeIndex = 3;
        this.getDataListLike('3', '');
      },
      changeSamples(type, subType) {
        this.homeShow = false;
        this.isHome = false;
        this.getDataList(type, subType);
      }, getDataList(type, subType) {
        this.queryParam.type = '';
        this.queryParam.subType = '';
        if (type)
          this.queryParam.type = type;
        if (subType)
          this.queryParam.subType = subType;
        this.$api.homeApi.getNoteList(this.queryParam).then((res) => {
          this.tableData = res.data.page.list
          this.totalPage = res.data.page.totalPage
        })
      },
      getDataListLike(type, subType) {
        this.queryParam.type = '';
        this.queryParam.subType = '';
        debugger
        if (type)
          this.queryParam.type = type;
        if (subType)
          this.queryParam.subType = subType;
        this.queryParam.queryText = this.search;
        this.$api.homeApi.getNoteList(this.queryParam).then((res) => {
          this.tableData = res.data.page.list
          this.totalPage = res.data.page.totalPage
          this.queryParam.queryText = '';
          this.search = '';
        })
      },
      getPicList() {
        this.$api.homeApi.getPicList(this.queryPicParam).then((res) => {
          this.pics = res.data.page.list
        })
      },
      showOne(type) {
        this.queryParam.type = '1';
        if (type)
          this.queryParam.type = type;
        this.queryParam.subType = '';
        this.$api.homeApi.getNoteList(this.queryParam).then((res) => {
          this.noteContext = res.data.page.list[0].context;
        })
      },
      switchContext(subType) {
        console.log("switch")
        if (this.homeShow) {
          console.log("switch homeShow")
          this.homeShow = false;
          console.log("homeShow", this.homeShow)
        } else {
          this.homeShow = true;
        }
        console.log("homeShow", this.homeShow)

      },
      rowClick(record, index) {
        console.log("rowClick", record);
        this.ArticleContent = record.ArticleContent
        this.$api.homeApi.getNoteById(record.id).then((res) => {
          console.log("res", res);
          this.noteContext = res.data.note.context;
        })
        this.homeShow = true;
        this.isHome = false;

      },
    }
  };
</script>
<style scoped>
  .anlicon {
    height: 365px;
    overflow: hidden;
    margin: 0 auto 0 50px;
  }

  .anlipic {
    width: 185px;
    height: 135px;
    margin: 0 auto;
    text-align: center;
    overflow: hidden;
    line-height: 100%;
    border: 1px solid #D8D8D8;
    border-radius: 3px;
    -webkit-border-radius: 3px;
    padding: 2px;
    -webkit-box-shadow: 0 1px 10px #bbb;
    box-shadow: 0 1px 20px #bbb;
    margin-top: 7px;
  }

  .anli {
    margin: 0;
    margin-top: 0px;
    padding: 0;
    height: 365px;
    overflow: hidden;
  }

  .anlicon li p {
    color: #666;
    font-size: 12px;
    text-align: center;
    line-height: 3em;
    font-family: "microsoft yahei";
    white-space: nowrap;
    text-align: center;
    line-height: 3em;
    font-family: "microsoft yahei";
    height: 32px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-top: 1px;
    margin-bottom: -20px;
  }

  .anlipic img {
    vertical-align: middle;
    max-height: 100%;
    max-width: 100%;
    _height: 135px;
  }

  .anli ul {
    list-style: none;
    padding: 0;
  }

  .anlicon li {
    float: left;
    width: 20%;
    _width: 20%;
    margin: 10px 10px;
  }

  .anlipic a {
    text-decoration: none;
    color: #666;
  }

  .home {
    width: 980px;
    margin: 20px auto;
    background: white;
    padding: 10px;
    box-sizing: border-box;
  }

  .content {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
  }

  .lfv {
    width: 30%;
  }

  .rgv {
    width: 70%;
    padding-left: 10px;
    box-sizing: border-box;
    border-left: 1px dashed #D7D7D7;
  }

  .btv {
    padding: 10px;
    box-sizing: border-box;
  }

  .fir {
    display: flex;
    flex-direction: row;
    justify-content: start;
    align-items: center;
    /* overflow: hidden; */
    padding: 16px 4px;
    box-sizing: border-box;
    line-height: 26px;
  }

  .modtit {
    height: 30px;
    background: url(../static/titlelay.png) center repeat-x;
    overflow: hidden;
    width: 250px;
  }

  .modtit_bottem {
    height: auto;
    background: url(../static/titlelay.png) center repeat-x;
    overflow: hidden;
  }

  .modtit h3 {
    background: #fff url(../static/titlebtn.png) left center no-repeat;
    height: 30px;
    line-height: 30px;
    float: left;
    padding: 0 1em 0 1.5em;
    font-family: "microsoft yahei";
    font-size: 14px;
    font-weight: normal;
    margin: 0;
  }

  .modtit_bottem h3 {
    background: #fff url(../static/titlebtn.png) left center no-repeat;
    height: 30px;
    line-height: 30px;
    float: left;
    padding: 0 1em 0 1.5em;
    font-family: "microsoft yahei";
    font-size: 14px;
    font-weight: normal;
    margin: 0;
  }

  .listl {
    float: left;
    /*overflow: hidden;*/
    width: 250px;
    margin-left: -30px;
  }

  .tit {
    font-size: 14px;
  }

  .lfc {
    width: 50px;
  }

  .rgc {
    margin-left: 30px;
    width: 140px;
    overflow: hidden;
  }

  .ml {
    margin-left: 10px;
  }

  .main .mod {
    overflow: hidden;
    _height: 100%;
  }

  .topv {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }

  .cateul {
    width: 280px;
    float: left;
  }

  .top {
    width: 980px;
    height: 100px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .menuv {
    width: 100%;
    height: 46px;
    line-height: 46px;
    background-color: rgb(84, 92, 100);
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .menu {
    width: 980px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }

  .flx {
    flex: 1;
    text-align: center;
    color: white;
    cursor: pointer;
  }

  .defBack {
    background: #151515;
  }

  .flx:hover {
    background: #151515;
  }

  .lunbo {
    width: 980px;
    margin: 0 auto;
    height: 320px;
  }

  .lunbo img {
    vertical-align: middle;
    max-height: 100%;
    max-width: 100%;
    height: 330px;
  }

  ::v-deep.el-menu-item {
    flex: 1;
    height: 46px !important;
    line-height: 46px !important;
  }

  /* 轮播图 */
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 360px;
    margin: 0;
  }

  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }

  .body {
    color: #666;
    font-size: 12px;
    font-family: Arial, tahoma;
    background: #f1f1f1;
  }

  .modcon {
    overflow: hidden;
    padding: 16px 4px;
    line-height: 26px;
  }

  .modcate {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .modcate li {
    height: 28px;
    line-height: 28px;
    padding-left: 2.5em;
    background: url(../static/dot2.png) left center no-repeat;
    border-bottom: 1px dashed #EBEBEB;
    margin: 0;
    color: #666;
    font-size: 12px;
    font-family: Arial, tahoma;
  }

  .tdtext {
    color: #666;
    font-size: 12px;
    font-family: Arial, tahoma;
  }

  img {
    max-width: 100%;
    /*max-height: 100%;*/
    object-fit: cover;
  }
</style>
